package kr.or.kosta.otr.persistence.mentor;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;

import javax.annotation.Resource;

import kr.or.kosta.otr.vo.MentorVO;

import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;

@Repository("MentorDao")
public class MentorDaoImpl implements MentorDao{
	@Resource(name="sqlMapClient")
	private SqlMapClient sqlMapClient;
	
	
	@Override
	public void addMentor(MentorVO vo) throws SQLException {
		sqlMapClient.insert("Mentor.addMentor",vo);
	}

	@Override
	public void deleteMentor(int mentorId) throws SQLException {
		sqlMapClient.delete("Mentor.deleteMentor",mentorId);
	}

	@Override
	public ArrayList<MentorVO> getAllMentor(HashMap<String, Object> map) throws SQLException {
		return (ArrayList<MentorVO>) sqlMapClient.queryForList("Mentor.getAllMentor",map);
	}

	@Override
	public int isExistMentor(HashMap<String, Object> map) throws SQLException {
		// TODO Auto-generated method stub
		return (int) sqlMapClient.queryForObject("Mentor.isExistMentor", map);
	}

}
